# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :get_time.py
# @Time      :2025/1/26 14:37:35
# @Author    :flower

import time
from util.get_log import logger


class GetTime:

    @staticmethod
    def get_local_day():
        timestamp = time.time()
        return time.strftime("%Y%m%d", time.localtime(timestamp))

    @staticmethod
    def get_local_second():
        timestamp = time.time()
        return time.strftime("%Y%m%d%H%M%S", time.localtime(timestamp))

    @staticmethod
    def run_cost_time(func):
        def fun(*args, **kwargs):
            t = time.perf_counter()
            result = func(*args, **kwargs)
            logger.info(f'函数{func.__name__} 运行时间: {time.perf_counter() - t:.8f}s')
            return result
        return fun


if __name__ == "__main__":
    print(GetTime.get_local_second())
